package com.superhelper.deliver.task;

import org.springframework.context.ApplicationContext;

import com.superhelper.common.domain.DeliverRecord;
import com.superhelper.common.domain.Task;
import com.superhelper.common.mapper.DeliverRecordMapper;
import com.superhelper.common.mapper.TaskMapper;
import com.superhelper.deliver.service.DeliverService;

public class DeliverRecordQueryTask extends AbstractTaskRunnable {

    public DeliverRecordQueryTask(ApplicationContext appContext, TaskMapper taskMapper, Task task) {
        super(appContext, taskMapper, task);
    }

    @Override
    protected boolean execute() {
        log.info("run start taskId:{}", task.getId());
        DeliverRecord dr = appContext.getBean(DeliverRecordMapper.class).getById(Long.valueOf(task.getObjId()));
        DeliverService deliverService = appContext.getBean(DeliverService.class);
        return deliverService.query(dr);
    }

}
